// 在当前模块：API进行统一管理
import requests from './request'
import mockRequests from './mockRequest'

// 三级联动导航接口
//   /api/product/getBaseCategoryList   get  无参请求
export const reqCategoryList = () => requests({url: '/product/getBaseCategoryList',method: 'GET'}).catch(err => {});
// 请求轮播图的数据 mock的数据
export const reqBannerList = () => mockRequests({url: '/banner',method: 'GET'});
// 请求floor的数据 mock的数据
export const reqFloorsList = () => mockRequests({url: '/floors',method: 'GET'});
// 获取搜索模块数据
export const reqSearchList = (params) => requests({url: '/list',method: 'POST',data:params});
// 获取商品详情
export const reqGoodDetail = (skuId) => requests({url: `/item/${skuId}`,method: 'GET'});
// 将产品添加到购物车中（或更新某一个产品的个数）
export const reqAddOrUpdateShopCart = (skuId,skuNum) => requests({url:`/cart/addToCart/${skuId}/${skuNum}`,method: 'POST'})
// 获取购物车列表
export const reqCartList = ()=> requests({url:'/cart/cartList'});
// 删除购物车中的某一个商品
export const reqDeleteCartById = (skuId)=> requests({url:`/cart/deleteCart/${skuId}`,method:'delete'});
// 切换商品选中状态
export const reqUpdateCheckedById = (skuId,isChecked) => requests({url: `/cart/checkCart/${skuId}/${isChecked}`,method:'GET'});
// 登录的实现/api/user/passport/sendCode/{phone}
export const reqSendCode = (phone) => requests({url:`/user/passport/sendCode/${phone}`,method:'GET'});
// 注册接口  /api/user/passport/register
export const reqUserRegister = ({phone,password,code}) => requests({url:`/user/passport/register`,method:'POST',data:{phone,password,code}});
// 用户登录 /api/user/passport/login
export const reqUserLogin = ({phone,password}) => requests({url:`/user/passport/login`,method:'POST',data:{phone,password}});
// 获取用户信息/api/user/passport/auth/getUserInfo
export const reqUserInfo = () => requests({url:'/user/passport/auth/getUserInfo',method: 'GET'});
// 用户退出登录/api/user/passport/logout
export const reqUserLogout = () => requests({url:'/user/passport/logout', method: 'GET'});
// 获取用户的收货地址信息/api/user/userAddress/auth/findUserAddressList
export const reqUserAddress = () => requests({url:'/user/userAddress/auth/findUserAddressList',method: 'GET'});
// 获取订单信息/api/order/auth/trade
export const reqOrderInfo = () => requests({url:'/order/auth/trade',method: 'GET'});
// 提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqSubmitOrder = (tradeNo,data) => requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method: 'POST',data});
// 获取订单支付信息/api/payment/weixin/createNative/{orderId}
export const reqOrderPayInfo = (orderId) => requests({url:`/payment/weixin/createNative/${orderId}`,method: 'GET'});
// 获取支付订单状态/api/payment/weixin/queryPayStatus/{orderId}
export const reqPayStatus = (orderId) => requests({url:`/payment/weixin/queryPayStatus/${orderId}`});
// 获取用户订单列表/api/order/auth/{page}/{limit}
export const reqOrderList = (page,limit) => requests({url:`/order/auth/${page}/${limit}`});